//
//  NSString+AIExtension.m
//  SelfPage
//
//  Created by alex on 14/11/24.
//  Copyright (c) 2014年 alex. All rights reserved.
//

#import "NSString+AIExtension.h"




@implementation NSString (AIExtension)

- (CGFloat)heightWithFont:(UIFont *)aFont maxWidth:(CGFloat)maxWidth
{
    
    if (self.length == 0 || self == nil) {
        return 0.0f;
    }
    
    CGSize size = [self boundingRectWithSize:CGSizeMake(maxWidth, 0) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingTruncatesLastVisibleLine|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:aFont} context:nil].size;

    return size.height;
}

@end
